//
//  SLBaseNaviHeader.m
//  StarLight
//
//  Created by 吴涛 on 16/5/9.
//  Copyright © 2016年 Duke.Wu. All rights reserved.
//

#import "SLBaseNaviHeader.h"

@interface SLBaseNaviHeader ()



@property (nonatomic, strong) UILabel *headerTitleLabel;

@end


@implementation SLBaseNaviHeader

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.leftLabel];
        [self addSubview:self.rightLabel];
        [self addSubview:self.headerTitleLabel];
        
        [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self).offset(11);
            make.left.equalTo(self).offset(16);
        }];
        
        [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.leftLabel);
            make.right.equalTo(self).offset(-16);
        }];
        
        [self.headerTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self).offset(11);
            make.centerX.equalTo(self);
        }];
    }
    return self;
}


#pragma mark - Public Methods

- (void)setNaviTitleWithString:(NSString *)title{
    self.leftLabel.text = title;
}

- (void)setNaviRightTitleWithString:(NSString *)title
{
    self.rightLabel.text = title;
}

- (void)setHeaderTitleWithString:(NSString *)title{
    self.headerTitleLabel.text = title;
}


#pragma mark - getter

- (UILabel *)leftLabel{
    if (!_leftLabel) {
        _leftLabel = [UILabel new];
        _leftLabel.font = [UIFont boldSystemFontOfSize:20];
        _leftLabel.textColor = RGBCOLOR(253,207,0);
    }
    return _leftLabel;
}


- (UILabel *)rightLabel{
    if (!_rightLabel) {
        _rightLabel = [UILabel new];
        _rightLabel.font = [UIFont boldSystemFontOfSize:20];
        _rightLabel.textColor = RGBCOLOR(253,207,0);
    }
    return _rightLabel;
}

- (UILabel *)headerTitleLabel{
    if (_headerTitleLabel) {
        _headerTitleLabel = [UILabel new];
        _headerTitleLabel.font = [UIFont boldSystemFontOfSize:16];
        _headerTitleLabel.textColor = RGBCOLOR(253,207,0);
    }
    return _headerTitleLabel;
}


@end
